import axios from 'axios'
import commonUrl from '../common/js/commonUrl.js'
import qs from 'qs'
import { loadVillageId, loadUserId } from '../common/js/cache'

export function getMangers () {
  const url = `${commonUrl.apihost}/index.php/home/index/role`
  const data = {
    user_id: loadUserId(),
    areas_id: loadVillageId()
  }
  return axios({
    method: 'POST',
    url: url,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(data)
  }).then((res) => {
    return Promise.resolve(res.data)
  }).catch((err) => {
    return Promise.reject(err)
  })
}
